export interface IUploadFileDto {
  type: string;
  id: number;
  uid: string;
  status: string;
  size: number;
  name: string;
  ossKey: string;
  thumbUrl: string;
  url: string;
}

export class UploadFileDto implements IUploadFileDto {
  type: string;
  id: number;
  uid: string;
  status: string;
  size: number;
  name: string;
  ossKey: string;
  thumbUrl: string;
  url: string;

  constructor(data?: IUploadFileDto) {
    if (data) {
      for (var property in data) {
        if (data.hasOwnProperty(property))
          (<any>this)[property] = (<any>data)[property];
      }
    }
  }

  init(data?: any) {
    if (data) {
      this.type = data["type"];
      this.id = data["id"];
      this.uid = data["uid"];
      this.size = data["size"];
      this.status = data["status"];
      this.name = data["name"];
      this.ossKey = data["ossKey"];
      this.thumbUrl = data["thumbUrl"];
      this.url = data["url"];
    }
  }

  static fromJS(data: any): UploadFileDto {
    data = typeof data === 'object' ? data : {};
    let result = new UploadFileDto();
    result.init(data);
    return result;
  }

  toJSON(data?: any) {
    data = typeof data === 'object' ? data : {};
    data["type"] = this.type;
    data["id"] = this.id;
    data["uid"] = this.uid;
    data["size"] = this.size;
    data["status"] = this.status;
    data["name"] = this.name;
    data["ossKey"] = this.ossKey;
    data["thumbUrl"] = this.thumbUrl;
    data["url"] = this.url;

    return data;
  }

  clone() {
    const json = this.toJSON();
    let result = new UploadFileDto();
    result.init(json);
    return result;
  }
}


